<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
      input {
            background-color: yellow;
            border: 0;
            outline: 0;
            width: 98%;
            font-size:20px;
        }   
    </style>
</head>
<body>

    <table border="1" width="300" onclick="tbupdate()">
        <tr>
            <td>1</td><td>2</td><td>3</td>
        </tr>
        <tr>
            <td>4</td><td>5</td><td>6</td>
        </tr>
    </table>

</body>
<script>
function tbupdate(){
    let td = event.srcElement;
    if(td.tagName == 'TD' ){
        console.log( td );
        let v = td.innerText;
        //放文本框
        td.innerHTML = `<input onblur="tdset(this)" type="text" value="${v}"/>`;
    }
}
// 文本框失去焦点时 
function tdset(obj){
    console.log('谁', obj );
    let v = obj.value;  // 框里的值
    // td = ? input父
    obj.parentNode.innerHTML = v ;
}
</script>
</html>